#include <string>

class IJob
{
public:
	IJob() {};
	virtual ~IJob() {};

	virtual void operator()() = 0;
	virtual void returnToPool() = 0;
};
class NullParamJob : public IJob
{
public:
	typedef NullParamJob CacheData;
	typedef void(*Func)();

	NullParamJob(Func theFunc)
		:funcM(theFunc)
	{}
	~NullParamJob() {}

	NullParamJob()
		:funcM(NULL)
	{}
	void init(Func theFunc)
	{
		funcM = theFunc;
	}


	virtual void operator()()
	{
		funcM();
	}

	virtual void returnToPool()
	{
		allocatorM->freeData(this);
	}

private:
	Func funcM;

public:
	union
	{
		AllocatorType* allocatorM;
		CacheData* nextFreeM;
	};
};


class Processor
{
	template<typename ParamType1>
	int process(
		const unsigned long long theId,
		void(*theFunc)(ParamType1),
		ParamType1 theParam);

	template<typename ClassType>
	int process(
		const unsigned long long theId,
		void (ClassType::*theFunc)(),
		ClassType*const theObj);

	template<typename ClassType>
	int process(
		const unsigned long long theId,
		void (ClassType::*theFunc)(),
		boost::shared_ptr<ClassType> theObj);
};